NAME=nehet
VERSION = 1
PATCHLEVEL = 1
SUBLEVEL = 1
EXTRAVERSION ?=

REL_VERSION=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)
RELEASE=$(REL_VERSION)$(EXTRAVERSION)

SRCS=$(filter-out $(NAME).cpp, $(wildcard *.cpp)) $(wildcard ./Socket/*.cpp) $(wildcard ./rtmp/*.cpp) $(wildcard ./sip/*.cpp) $(wildcard ./md5/*.cpp)
HDRS=$(SRCS:.cpp=.h)
OBJS=$(SRCS:.cpp=.o)
CXX = g++
CC = gcc
LD = $(CC) -lpthread -losip2 -losipparser2 -lortp
OBJPTH = obj/
CXXFLAGS += -Wall $(EXTRA_CXXFLAGS)

LDFLAGS += -pthread -lnsl

.PHONY: all
all:
	  $(MAKE) $(NAME)


.PHONY: clean
clean:
	rm -f $(OBJS) $(DEPS) $(NAME) $(NAME).o
	rm -f lib/*.so
	$(MAKE) -C $(PLUGIN_DIR) clean

.PHONY: deps
deps: $(DEPS)

.PHONY: doc
doc:
	rm -Rf doxygen_output; doxygen doxygen_proj ; \
	rm -rf ../doc/doxygen_doc ; mv doxygen_output ../doc/doxygen_doc

.PHONY: fulldoc
fulldoc:
	rm -Rf doxygen_output; doxygen doxygen_fulldoc ; \
	rm -rf ../doc/doxygen_fulldoc ; mv doxygen_output ../doc/doxygen_fulldoc


LDFLAGS += -lstdc++

ifdef USE_LIBSAMPLERATE
LDFLAGS +=-lsamplerate
endif

ifdef WITH_ZRTP
LDFLAGS +=-lzrtp -lbn
endif

# implicit rules
%.o : %.cpp %.d
	$(CXX) -o $@  $< $(CPPFLAGS) $(CXXFLAGS)

$(NAME): $(NAME).o $(OBJS)
	$(LD) -o $(NAME) $(NAME).o $(OBJS) $(LDFLAGS)
